package com.sdkj.Entity.service;

import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.Transient;

import com.sdkj.Entity.BaseEntity;
import com.sdkj.Entity.sys.Images;

@Entity
@Table(name="products")
public class Products extends BaseEntity {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	
	
	private String name;
	private String prodTime;//产品完成时间
	private String summary;//简述
	private String description;//详细描述
	
	private Images img;//产品显示图片
	
	private String imgUrl;
	
	@Transient
	public String getImgUrl() {
		return img==null?"/images/lunbo/01.jpg":img.getImgUrl();
	}
	public void setImgUrl(String imgUrl) {
		this.imgUrl = imgUrl;
	} 

	@Column(length=100)
	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}
	@Column(length=20)
	public String getProdTime() {
		return prodTime;
	}
	public void setProdTime(String prodTime) {
		this.prodTime = prodTime;
	}
	@Column(length=300)
	public String getSummary() {
		return summary;
	}

	public void setSummary(String summary) {
		this.summary = summary;
	}
	@Column(length=10000)
	public String getDescription() {
		return description;
	}

	public void setDescription(String description) {
		this.description = description;
	}
	

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "img")
	public Images getImg() { 
		return img;
	}

	public void setImg(Images img) { 
		this.img = img;
	}

	public Products() {
		super();
	}


	public Products(String uuid, Date createTime) {
		super(uuid, createTime);
	}

	

	public Products(String name, String prodTime, String summary,
			String description, Images prodImg) {
		super();
		this.name = name;
		this.prodTime = prodTime;
		this.summary = summary;
		this.description = description;
		this.img = prodImg;
	}

	@Override
	public String toString() {
		return "Products [name=" + name + ", prodTime=" + prodTime
				+ ", summary=" + summary + ", description=" + description
				+ ", prodImg=" + img + "]";
	}

	
	
	

}
